import { useEffect, useState } from 'react';
import { getAppMenuApi } from './api';

export const useDetailScreen = () => {
    const [menuData, setMenuData] = useState<any[]>([]);

    useEffect(() => {
        // 页面加载时调用getAppMenu接口
        const fetchAppMenu = async () => {
            try {
                const result = await getAppMenuApi();
                setMenuData(result.data || []);
                // console.log('DetailScreen页面获取菜单成功:', result);


            } catch (error) {
                setMenuData([]);
                console.error('DetailScreen页面获取菜单失败:', error);
            }
        };

        fetchAppMenu();
    }, []);

    return { menuData, setMenuData };
}; 